package com.yc.backoffice.service.impl;

import com.yc.backoffice.mapper.ItemsMapper;
import com.yc.backoffice.model.Items;
import com.yc.backoffice.service.IItemsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ItemsServiceImpl implements IItemsService {

    @Autowired
    private ItemsMapper itemsMapper;

    @Override
    public List<Items> findAll() {
        return itemsMapper.findAllList();
    }

    @Override
    public Items findById(Integer id) {
        return null;
    }

    @Override
    public void saveOrUpdate(Items items) {
        if(items.getId()==null){
            itemsMapper.insert(items);
        }else{
            itemsMapper.updateByPrimaryKey(items);
        }
    }
}
